﻿using System;

namespace DigitalQuran.Threading {
    
    /// <summary>
    /// Represent an Background Operation
    /// </summary>
    public struct BackgroundOperation {

        /// <summary>
        /// Create new instance
        /// <param name="action">Action to perform</param>
        /// <param name="message">Short message for this operation</param>
        /// </summary>
        public BackgroundOperation(Action action, string message)
            : this() {

            this.Action = action;
            this.Message = message;
        }

        public BackgroundOperation(string message, Func<object> func) : this() {
            this.Action = new Action(() => { func(); });
            this.Message = message;
        }

        /// <summary>
        /// Gets the Action to perform
        /// </summary>
        public Action Action { get; private set; }

        /// <summary>
        /// Gets the Action short message to show in splash screen
        /// </summary>
        public string Message { get; private set; }
    }
}